From f9b2f5e1cc913407ede4a427ea1f1a4b00ca8f8b Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 2 Nov 2014 17:54:06 -0800 Subject: [PATCH] Update to rust master --- .travis.install.deps.sh | 4 +- Cargo.lock | 22 +++++----- src/bin/cargo.rs | 1 + src/cargo/core/registry.rs | 7 ++-- src/cargo/core/resolver/mod.rs | 3 +- src/cargo/core/source.rs | 53 ++++++++++++------------ src/cargo/lib.rs | 23 ++++------ src/cargo/ops/cargo_compile.rs | 11 +++-- src/cargo/ops/cargo_rustc/context.rs | 22 ++++++---- src/cargo/ops/cargo_rustc/fingerprint.rs | 2 +- src/cargo/ops/cargo_rustc/job_queue.rs | 9 ++-- src/cargo/ops/cargo_rustc/mod.rs | 12 ++++-- src/cargo/sources/git/source.rs | 4 +- src/cargo/sources/registry.rs | 6 +-- src/cargo/util/config.rs | 36 ++++++++-------- src/cargo/util/dependency_queue.rs | 2 +- src/cargo/util/graph.rs | 3 +- src/etc/dl-snapshot.py | 6 ++- 18 files changed, 117 insertions(+), 109 deletions(-) diff --git a/.travis.install.deps.sh b/.travis.install.deps.sh index bece34213..f9eeb1522 100755 --- a/.travis.install.deps.sh +++ b/.travis.install.deps.sh @@ -52,9 +52,9 @@ if [ -z "${windows}" ]; then else rm -rf rustc *.exe if [ "${BITS}" = "64" ]; then - triple=x86_64-w64-mingw32 + triple=x86_64-pc-windows-gnu else - triple=i686-w64-mingw32 + triple=i686-pc-windows-gnu fi curl -O http://$host/dist/rust-nightly-$triple.exe innounp -y -x rust-nightly-$triple.exe diff --git a/Cargo.lock b/Cargo.lock index 2db9da27b..e1ea26d0a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,7 +3,7 @@ name = "cargo" version = "0.0.1-pre" dependencies = [ "curl 0.0.1 (git+https://github.com/alexcrichton/curl-rust?ref=bundle)", - "docopt 0.6.5 (git+https://github.com/docopt/docopt.rs)", + "docopt 0.6.8 (git+https://github.com/docopt/docopt.rs)", "flate2 0.0.1 (git+https://github.com/alexcrichton/flate2-rs)", "git2 0.0.1 (git+https://github.com/alexcrichton/git2-rs)", "glob 0.0.1 (git+https://github.com/rust-lang/glob)", @@ -18,7 +18,7 @@ dependencies = [ [[package]] name = "curl" version = "0.0.1" -source = "git+https://github.com/alexcrichton/curl-rust?ref=bundle#28d4a3d0dde0cde6b6f46fc928656cb251832888" +source = "git+https://github.com/alexcrichton/curl-rust?ref=bundle#b595431adb3ff1ad55e3cff30ee8b0c05d9103a0" dependencies = [ "curl-sys 0.0.1 (git+https://github.com/alexcrichton/curl-rust?ref=bundle)", "link-config 0.0.1 (git+https://github.com/alexcrichton/link-config)", @@ -29,27 +29,27 @@ dependencies = [ [[package]] name = "curl-sys" version = "0.0.1" -source = "git+https://github.com/alexcrichton/curl-rust?ref=bundle#28d4a3d0dde0cde6b6f46fc928656cb251832888" +source = "git+https://github.com/alexcrichton/curl-rust?ref=bundle#b595431adb3ff1ad55e3cff30ee8b0c05d9103a0" [[package]] name = "docopt" -version = "0.6.5" -source = "git+https://github.com/docopt/docopt.rs#6db6dc0177ea739be9b90f18ab87a674413797a1" +version = "0.6.8" +source = "git+https://github.com/docopt/docopt.rs#1b614c83b771b23e95e69d10b4bc04c87ff7eff3" [[package]] name = "encoding" version = "0.1.0" -source = "git+https://github.com/lifthrasiir/rust-encoding#6daaad9f4c0fcde4525821032686090d6426c462" +source = "git+https://github.com/lifthrasiir/rust-encoding#a739425a3f3174a31fe38c158dcaf22ea1d856f4" [[package]] name = "flate2" version = "0.0.1" -source = "git+https://github.com/alexcrichton/flate2-rs#67be37548937c059370ce272efe1142fbf198d67" +source = "git+https://github.com/alexcrichton/flate2-rs#31d9253355ba837cd62487b8766bf2be89f334a3" [[package]] name = "git2" version = "0.0.1" -source = "git+https://github.com/alexcrichton/git2-rs#35a0632e92d63de8218675a17cd81e15d0de44b4" +source = "git+https://github.com/alexcrichton/git2-rs#556e27113a4918cede9b80e447a5ebad524f3357" dependencies = [ "libgit2 0.0.1 (git+https://github.com/alexcrichton/git2-rs)", "url 0.1.0 (git+https://github.com/servo/rust-url)", @@ -68,7 +68,7 @@ source = "git+https://github.com/carllerche/hamcrest-rust.git#998036d000095f72c8 [[package]] name = "libgit2" version = "0.0.1" -source = "git+https://github.com/alexcrichton/git2-rs#35a0632e92d63de8218675a17cd81e15d0de44b4" +source = "git+https://github.com/alexcrichton/git2-rs#556e27113a4918cede9b80e447a5ebad524f3357" dependencies = [ "libssh2-static-sys 0.0.1 (git+https://github.com/alexcrichton/libssh2-static-sys)", "link-config 0.0.1 (git+https://github.com/alexcrichton/link-config)", @@ -78,7 +78,7 @@ dependencies = [ [[package]] name = "libssh2-static-sys" version = "0.0.1" -source = "git+https://github.com/alexcrichton/libssh2-static-sys#80e71a3021618eb05656c58fb7c5ef5f12bc747f" +source = "git+https://github.com/alexcrichton/libssh2-static-sys#c0dc19bd7a9096b6c79911f4135cd4fb79962127" [[package]] name = "link-config" @@ -110,7 +110,7 @@ source = "git+https://github.com/alexcrichton/tar-rs#47d2cc4b09e373a4cc7bee7c71e [[package]] name = "toml" version = "0.1.0" -source = "git+https://github.com/alexcrichton/toml-rs#71d1689d63ef1af41addef330e314a56e88f48a9" +source = "git+https://github.com/alexcrichton/toml-rs#78acb5081d57bec85fd51ecb596506b14d17d430" [[package]] name = "url" diff --git a/src/bin/cargo.rs b/src/bin/cargo.rs index d82d297ab..d0bdc10a9 100644 --- a/src/bin/cargo.rs +++ b/src/bin/cargo.rs @@ -113,6 +113,7 @@ fn execute(flags: Flags, shell: &mut MultiShell) -> CliResult> { s => (flags.arg_args.clone(), s), }; args.insert(0, command.to_string()); + args.insert(0, os::args()[0].clone()); macro_rules! cmd( ($name:ident) => ( if command.as_slice() == stringify!($name).replace("_", "-").as_slice() { diff --git a/src/cargo/core/registry.rs b/src/cargo/core/registry.rs index 7f1e6dab0..26e613dae 100644 --- a/src/cargo/core/registry.rs +++ b/src/cargo/core/registry.rs @@ -1,4 +1,5 @@ -use std::collections::hashmap::{HashSet, HashMap, Occupied, Vacant}; +use std::collections::HashSet; +use std::collections::hash_map::{HashMap, Occupied, Vacant}; use core::{Source, SourceId, SourceMap, Summary, Dependency, PackageId, Package}; use util::{CargoResult, ChainError, Config, human, profile}; @@ -36,7 +37,7 @@ impl Registry for Vec { /// operations if necessary) and is ready to be queried for packages. pub struct PackageRegistry<'a> { sources: SourceMap<'a>, - config: &'a mut Config<'a>, + config: &'a Config<'a>, // A list of sources which are considered "overrides" which take precedent // when querying for packages. @@ -70,7 +71,7 @@ enum Kind { } impl<'a> PackageRegistry<'a> { - pub fn new<'a>(config: &'a mut Config<'a>) -> PackageRegistry<'a> { + pub fn new<'a>(config: &'a Config<'a>) -> PackageRegistry<'a> { PackageRegistry { sources: SourceMap::new(), source_ids: HashMap::new(), diff --git a/src/cargo/core/resolver/mod.rs b/src/cargo/core/resolver/mod.rs index 462f44927..03ae387d3 100644 --- a/src/cargo/core/resolver/mod.rs +++ b/src/cargo/core/resolver/mod.rs @@ -1,5 +1,6 @@ use std::cell::RefCell; -use std::collections::hashmap::{HashMap, HashSet, Occupied, Vacant}; +use std::collections::HashSet; +use std::collections::hash_map::{HashMap, Occupied, Vacant}; use std::fmt; use std::rc::Rc; use semver; diff --git a/src/cargo/core/source.rs b/src/cargo/core/source.rs index 3d9a717f1..e79555de1 100644 --- a/src/cargo/core/source.rs +++ b/src/cargo/core/source.rs @@ -1,6 +1,4 @@ -use std::cmp::Ordering; -use std::collections::HashMap; -use std::collections::hashmap::{Values, MutEntries}; +use std::collections::hash_map::{HashMap, Values, MutEntries}; use std::fmt::{mod, Show, Formatter}; use std::hash; use std::iter; @@ -185,7 +183,7 @@ impl SourceId { } /// Creates an implementation of `Source` corresponding to this ID. - pub fn load<'a>(&self, config: &'a mut Config) -> Box { + pub fn load<'a>(&self, config: &'a Config) -> Box { log!(5, "loading SourceId; {}", self); match self.inner.kind { GitKind(..) => box GitSource::new(self, config) as Box, @@ -319,17 +317,18 @@ impl hash::Hash for SourceId { } } -pub struct SourceMap<'a> { - map: HashMap> +pub struct SourceMap<'src> { + map: HashMap> } -pub type Sources<'a> = Values<'a, SourceId, Box>; -pub type SourcesMut<'a> = iter::Map<'static, (&'a SourceId, &'a mut Box), - &'a mut Source+'a, - MutEntries<'a, SourceId, Box>>; +pub type Sources<'a, 'src> = Values<'a, SourceId, Box>; +pub type SourcesMut<'a, 'src> = iter::Map<'static, (&'a SourceId, + &'a mut Box), + &'a mut Source+'src, + MutEntries<'a, SourceId, Box>>; -impl<'a> SourceMap<'a> { - pub fn new() -> SourceMap<'a> { +impl<'src> SourceMap<'src> { + pub fn new() -> SourceMap<'src> { SourceMap { map: HashMap::new() } @@ -339,27 +338,27 @@ impl<'a> SourceMap<'a> { self.map.contains_key(id) } - pub fn get(&self, id: &SourceId) -> Option<&Source+'a> { + pub fn get(&self, id: &SourceId) -> Option<&Source+'src> { let source = self.map.find(id); source.map(|s| { - let s: &Source+'a = &**s; + let s: &Source+'src = &**s; s }) } - pub fn get_mut(&mut self, id: &SourceId) -> Option<&mut Source+'a> { + pub fn get_mut(&mut self, id: &SourceId) -> Option<&mut Source+'src> { self.map.find_mut(id).map(|s| { - let s: &mut Source+'a = &mut **s; + let s: &mut Source+'src = &mut **s; s }) } - pub fn get_by_package_id(&self, pkg_id: &PackageId) -> Option<&Source+'a> { + pub fn get_by_package_id(&self, pkg_id: &PackageId) -> Option<&Source+'src> { self.get(pkg_id.get_source_id()) } - pub fn insert(&mut self, id: &SourceId, source: Box) { + pub fn insert(&mut self, id: &SourceId, source: Box) { self.map.insert(id.clone(), source); } @@ -367,27 +366,27 @@ impl<'a> SourceMap<'a> { self.map.len() } - pub fn sources(&'a self) -> Sources<'a> { + pub fn sources<'a>(&'a self) -> Sources<'a, 'src> { self.map.values() } - pub fn sources_mut(&'a mut self) -> SourcesMut<'a> { - self.map.iter_mut().map(|(_, v)| { let s: &mut Source+'a = &mut **v; s }) + pub fn sources_mut<'a>(&'a mut self) -> SourcesMut<'a, 'src> { + self.map.iter_mut().map(|(_, v)| &mut **v) } } /// List of `Source` implementors. `SourceSet` itself implements `Source`. -pub struct SourceSet<'a> { - sources: Vec> +pub struct SourceSet<'src> { + sources: Vec> } -impl<'a> SourceSet<'a> { - pub fn new(sources: Vec>) -> SourceSet<'a> { +impl<'src> SourceSet<'src> { + pub fn new(sources: Vec>) -> SourceSet<'src> { SourceSet { sources: sources } } } -impl<'a> Registry for SourceSet<'a> { +impl<'src> Registry for SourceSet<'src> { fn query(&mut self, name: &Dependency) -> CargoResult> { let mut ret = Vec::new(); @@ -399,7 +398,7 @@ impl<'a> Registry for SourceSet<'a> { } } -impl<'a> Source for SourceSet<'a> { +impl<'src> Source for SourceSet<'src> { fn update(&mut self) -> CargoResult<()> { for source in self.sources.iter_mut() { try!(source.update()); diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs index 800f2d59d..54269d2b0 100644 --- a/src/cargo/lib.rs +++ b/src/cargo/lib.rs @@ -30,6 +30,7 @@ use std::os; use std::io::stdio::{stdout_raw, stderr_raw}; use std::io::{mod, stdout, stderr}; use serialize::{Decoder, Encoder, Decodable, Encodable, json}; +use docopt::Docopt; use core::{Shell, MultiShell, ShellConfig}; use term::color::{BLACK}; @@ -131,9 +132,7 @@ pub fn call_main_without_stdin<'a, fn process<'a, V: Encodable, io::IoError>>( callback: |&[String], &mut MultiShell| -> CliResult>) { let mut shell = shell(true); - let mut args = os::args(); - args.remove(0); - process_executed(callback(args.as_slice(), &mut shell), &mut shell) + process_executed(callback(os::args().as_slice(), &mut shell), &mut shell) } pub fn process_executed<'a, @@ -222,18 +221,12 @@ pub fn version() -> String { fn flags_from_args<'a, T>(usage: &str, args: &[String], options_first: bool) -> CliResult where T: Decodable { - let args = args.iter().map(|a| a.as_slice()).collect::>(); - let config = docopt::Config { - options_first: options_first, - help: true, - version: Some(version()), - }; - let value_map = try!(docopt::docopt_args(config, args.as_slice(), - usage).map_err(|e| { - let code = if e.fatal() {1} else {0}; - CliError::from_error(e, code) - })); - value_map.decode().map_err(|e| { + let docopt = Docopt::new(usage).unwrap() + .options_first(options_first) + .argv(args.iter().map(|s| s.as_slice())) + .help(true) + .version(Some(version())); + docopt.decode().map_err(|e| { let code = if e.fatal() {1} else {0}; CliError::from_error(e, code) }) diff --git a/src/cargo/ops/cargo_compile.rs b/src/cargo/ops/cargo_compile.rs index 6d7568f70..2947efa4b 100644 --- a/src/cargo/ops/cargo_compile.rs +++ b/src/cargo/ops/cargo_compile.rs @@ -83,11 +83,11 @@ pub fn compile_pkg(package: &Package, options: &mut CompileOptions) let user_configs = try!(config::all_configs(os::getcwd())); let override_ids = try!(source_ids_from_config(&user_configs, package.get_root())); + let config = try!(Config::new(*shell, jobs, target.clone())); let (packages, resolve_with_overrides, sources) = { - let mut config = try!(Config::new(*shell, jobs, target.clone())); let rustc_host = config.rustc_host().to_string(); - let mut registry = PackageRegistry::new(&mut config); + let mut registry = PackageRegistry::new(&config); // First, resolve the package's *listed* dependencies, as well as // downloading and updating all remotes and such. @@ -138,13 +138,12 @@ pub fn compile_pkg(package: &Package, options: &mut CompileOptions) let ret = { let _p = profile::start("compiling"); - let mut config = try!(Config::new(*shell, jobs, target)); - try!(scrape_target_config(&mut config, &user_configs)); + try!(scrape_target_config(&config, &user_configs)); try!(ops::compile_targets(env.as_slice(), targets.as_slice(), to_build, &PackageSet::new(packages.as_slice()), &resolve_with_overrides, &sources, - &mut config)) + &config)) }; return Ok(ret); @@ -174,7 +173,7 @@ fn source_ids_from_config(configs: &HashMap, }).map(|p| SourceId::for_path(&p)).collect() } -fn scrape_target_config(config: &mut Config, +fn scrape_target_config(config: &Config, configs: &HashMap) -> CargoResult<()> { let target = match configs.find_equiv("target") { diff --git a/src/cargo/ops/cargo_rustc/context.rs b/src/cargo/ops/cargo_rustc/context.rs index 4163b3f60..0ea5dc8f8 100644 --- a/src/cargo/ops/cargo_rustc/context.rs +++ b/src/cargo/ops/cargo_rustc/context.rs @@ -1,5 +1,5 @@ -use std::collections::{HashMap, HashSet}; -use std::collections::hashmap::{Occupied, Vacant}; +use std::collections::HashSet; +use std::collections::hash_map::{HashMap, Occupied, Vacant}; use std::str; use core::{SourceMap, Package, PackageId, PackageSet, Resolve, Target}; @@ -16,8 +16,8 @@ pub enum PlatformRequirement { PlatformPluginAndTarget, } -pub struct Context<'a, 'b> { - pub config: &'b mut Config<'b>, +pub struct Context<'a, 'b: 'a> { + pub config: &'b Config<'b>, pub resolve: &'a Resolve, pub sources: &'a SourceMap<'b>, pub compilation: Compilation, @@ -33,9 +33,9 @@ pub struct Context<'a, 'b> { requirements: HashMap<(&'a PackageId, &'a str), PlatformRequirement>, } -impl<'a, 'b> Context<'a, 'b> { - pub fn new(env: &'a str, resolve: &'a Resolve, sources: &'a SourceMap, - deps: &'a PackageSet, config: &'b mut Config<'b>, +impl<'a, 'b: 'a> Context<'a, 'b> { + pub fn new(env: &'a str, resolve: &'a Resolve, sources: &'a SourceMap<'b>, + deps: &'a PackageSet, config: &'b Config<'b>, host: Layout, target: Option, root_pkg: &Package) -> CargoResult> { @@ -95,8 +95,12 @@ impl<'a, 'b> Context<'a, 'b> { Some((dylib_parts[0].to_string(), dylib_parts[1].to_string())) }; - let exe_suffix = lines.next().unwrap().trim() - .split('-').skip(1).next().unwrap().to_string(); + let exe_suffix = if error.contains("dropping unsupported crate type `bin`") { + String::new() + } else { + lines.next().unwrap().trim() + .split('-').skip(1).next().unwrap().to_string() + }; Ok((dylib, exe_suffix.to_string())) } diff --git a/src/cargo/ops/cargo_rustc/fingerprint.rs b/src/cargo/ops/cargo_rustc/fingerprint.rs index 7313011fd..135cffeee 100644 --- a/src/cargo/ops/cargo_rustc/fingerprint.rs +++ b/src/cargo/ops/cargo_rustc/fingerprint.rs @@ -1,4 +1,4 @@ -use std::collections::hashmap::{Occupied, Vacant}; +use std::collections::hash_map::{Occupied, Vacant}; use std::hash::{Hash, Hasher}; use std::hash::sip::SipHasher; use std::io::{fs, File, USER_RWX, BufferedReader}; diff --git a/src/cargo/ops/cargo_rustc/job_queue.rs b/src/cargo/ops/cargo_rustc/job_queue.rs index 9c1b5f7b8..5097267d9 100644 --- a/src/cargo/ops/cargo_rustc/job_queue.rs +++ b/src/cargo/ops/cargo_rustc/job_queue.rs @@ -1,4 +1,5 @@ -use std::collections::hashmap::{HashMap, HashSet, Occupied, Vacant}; +use std::collections::HashSet; +use std::collections::hash_map::{HashMap, Occupied, Vacant}; use term::color::YELLOW; use core::{Package, PackageId, Resolve, PackageSet}; @@ -57,7 +58,7 @@ type Message = (PackageId, TargetStage, Freshness, CargoResult<()>); impl<'a, 'b> JobQueue<'a, 'b> { pub fn new(resolve: &'a Resolve, packages: &'a PackageSet, - config: &mut Config) -> JobQueue<'a, 'b> { + config: &Config) -> JobQueue<'a, 'b> { let (tx, rx) = channel(); JobQueue { pool: TaskPool::new(config.jobs()), @@ -98,7 +99,7 @@ impl<'a, 'b> JobQueue<'a, 'b> { /// This function will spawn off `config.jobs()` workers to build all of the /// necessary dependencies, in order. Freshness is propagated as far as /// possible along each dependency chain. - pub fn execute(&mut self, config: &mut Config) -> CargoResult<()> { + pub fn execute(&mut self, config: &Config) -> CargoResult<()> { let _p = profile::start("executing the job graph"); // Iteratively execute the dependency graph. Each turn of this loop will @@ -154,7 +155,7 @@ impl<'a, 'b> JobQueue<'a, 'b> { /// freshness of all upstream dependencies. This function will schedule all /// work in `jobs` to be executed. fn run(&mut self, pkg: &'a Package, stage: TargetStage, fresh: Freshness, - jobs: Vec<(Job, Freshness)>, config: &mut Config) -> CargoResult<()> { + jobs: Vec<(Job, Freshness)>, config: &Config) -> CargoResult<()> { let njobs = jobs.len(); let amt = if njobs == 0 {1} else {njobs}; let id = pkg.get_package_id().clone(); diff --git a/src/cargo/ops/cargo_rustc/mod.rs b/src/cargo/ops/cargo_rustc/mod.rs index 34f6d1aa0..146b9d861 100644 --- a/src/cargo/ops/cargo_rustc/mod.rs +++ b/src/cargo/ops/cargo_rustc/mod.rs @@ -72,7 +72,7 @@ fn uniq_target_dest<'a>(targets: &[&'a Target]) -> Option<&'a str> { pub fn compile_targets<'a>(env: &str, targets: &[&'a Target], pkg: &'a Package, deps: &PackageSet, resolve: &'a Resolve, sources: &'a SourceMap, - config: &'a mut Config<'a>) + config: &'a Config<'a>) -> CargoResult { if targets.is_empty() { return Ok(Compilation::new(pkg)) @@ -405,6 +405,10 @@ fn build_base_args(cx: &Context, .rpath(root_profile.get_rpath()) } + if profile.is_plugin() { + cmd = cmd.arg("-C").arg("prefer-dynamic"); + } + if profile.get_opt_level() != 0 { cmd = cmd.arg("--opt-level").arg(profile.get_opt_level().to_string()); } @@ -474,8 +478,10 @@ fn build_plugin_args(mut cmd: ProcessBuilder, cx: &Context, pkg: &Package, } cmd = opt(cmd, "--target", "", cx.config.target()); - cmd = opt(cmd, "-C", "ar=", cx.config.ar()); - cmd = opt(cmd, "-C", "linker=", cx.config.linker()); + cmd = opt(cmd, "-C", "ar=", cx.config.ar().as_ref() + .map(|s| s.as_slice())); + cmd = opt(cmd, "-C", "linker=", cx.config.linker().as_ref() + .map(|s| s.as_slice())); } return cmd; diff --git a/src/cargo/sources/git/source.rs b/src/cargo/sources/git/source.rs index 7febd6080..8e6ca6151 100644 --- a/src/cargo/sources/git/source.rs +++ b/src/cargo/sources/git/source.rs @@ -20,12 +20,12 @@ pub struct GitSource<'a, 'b:'a> { source_id: SourceId, path_source: Option, rev: Option, - config: &'a mut Config<'b>, + config: &'a Config<'b>, } impl<'a, 'b> GitSource<'a, 'b> { pub fn new<'a, 'b>(source_id: &SourceId, - config: &'a mut Config<'b>) -> GitSource<'a, 'b> { + config: &'a Config<'b>) -> GitSource<'a, 'b> { assert!(source_id.is_git(), "id is not git, id={}", source_id); let reference = match source_id.git_reference() { diff --git a/src/cargo/sources/registry.rs b/src/cargo/sources/registry.rs index 01d0a804f..e762d9feb 100644 --- a/src/cargo/sources/registry.rs +++ b/src/cargo/sources/registry.rs @@ -184,7 +184,7 @@ pub struct RegistrySource<'a, 'b:'a> { checkout_path: Path, cache_path: Path, src_path: Path, - config: &'a mut Config<'b>, + config: &'a Config<'b>, handle: Option, sources: Vec, hashes: HashMap<(String, String), String>, // (name, vers) => cksum @@ -226,7 +226,7 @@ struct RegistryDependency { impl<'a, 'b> RegistrySource<'a, 'b> { pub fn new(source_id: &SourceId, - config: &'a mut Config<'b>) -> RegistrySource<'a, 'b> { + config: &'a Config<'b>) -> RegistrySource<'a, 'b> { let hash = hex::short_hash(source_id); let ident = source_id.get_url().host().unwrap().to_string(); let part = format!("{}-{}", ident, hash); @@ -417,7 +417,7 @@ impl<'a, 'b> RegistrySource<'a, 'b> { let dep = try!(Dependency::parse(name.as_slice(), Some(req.as_slice()), &self.source_id)); - + Ok(dep.optional(optional) .default_features(default_features) .features(features) diff --git a/src/cargo/util/config.rs b/src/cargo/util/config.rs index bbb857562..941bf5d74 100644 --- a/src/cargo/util/config.rs +++ b/src/cargo/util/config.rs @@ -1,7 +1,7 @@ use std::{fmt, os, mem}; +use std::cell::{RefCell, RefMut, Ref}; +use std::collections::hash_map::{HashMap, Occupied, Vacant}; use std::io::fs::{PathExtensions, File}; -use std::collections::HashMap; -use std::collections::hashmap::{Occupied, Vacant}; use std::string; use serialize::{Encodable,Encoder}; @@ -14,11 +14,11 @@ use util::toml as cargo_toml; pub struct Config<'a> { home_path: Path, - shell: &'a mut MultiShell, + shell: RefCell<&'a mut MultiShell>, jobs: uint, target: Option, - linker: Option, - ar: Option, + linker: RefCell>, + ar: RefCell>, rustc_version: string::String, /// The current host and default target of rustc rustc_host: string::String, @@ -39,11 +39,11 @@ impl<'a> Config<'a> { human("Cargo couldn't find your home directory. \ This probably means that $HOME was not set.") })), - shell: shell, + shell: RefCell::new(shell), jobs: jobs.unwrap_or(os::num_cpus()), target: target, - ar: None, - linker: None, + ar: RefCell::new(None), + linker: RefCell::new(None), rustc_version: rustc_version, rustc_host: rustc_host, }) @@ -71,8 +71,8 @@ impl<'a> Config<'a> { self.home_path.join(".cargo").join("registry").join("src") } - pub fn shell(&mut self) -> &mut MultiShell { - &mut *self.shell + pub fn shell(&self) -> RefMut<&'a mut MultiShell> { + self.shell.borrow_mut() } pub fn jobs(&self) -> uint { @@ -83,17 +83,17 @@ impl<'a> Config<'a> { self.target.as_ref().map(|t| t.as_slice()) } - pub fn set_ar(&mut self, ar: string::String) { self.ar = Some(ar); } - - pub fn set_linker(&mut self, linker: string::String) { self.linker = Some(linker); } - - pub fn linker(&self) -> Option<&str> { - self.linker.as_ref().map(|t| t.as_slice()) + pub fn set_ar(&self, ar: string::String) { + *self.ar.borrow_mut() = Some(ar); } - pub fn ar(&self) -> Option<&str> { - self.ar.as_ref().map(|t| t.as_slice()) + + pub fn set_linker(&self, linker: string::String) { + *self.linker.borrow_mut() = Some(linker); } + pub fn linker(&self) -> Ref> { self.linker.borrow() } + pub fn ar(&self) -> Ref> { self.ar.borrow() } + /// Return the output of `rustc -v verbose` pub fn rustc_version(&self) -> &str { self.rustc_version.as_slice() diff --git a/src/cargo/util/dependency_queue.rs b/src/cargo/util/dependency_queue.rs index 1807ed284..3b4028ea6 100644 --- a/src/cargo/util/dependency_queue.rs +++ b/src/cargo/util/dependency_queue.rs @@ -5,7 +5,7 @@ //! it to figure out when a dependency should be built. use std::collections::{HashMap, HashSet}; -use std::collections::hashmap::{Occupied, Vacant}; +use std::collections::hash_map::{Occupied, Vacant}; use std::hash::Hash; pub struct DependencyQueue { diff --git a/src/cargo/util/graph.rs b/src/cargo/util/graph.rs index 5473b0b34..3ed6cc584 100644 --- a/src/cargo/util/graph.rs +++ b/src/cargo/util/graph.rs @@ -1,7 +1,8 @@ use std::fmt; use std::hash::Hash; use std::collections::{HashMap, HashSet}; -use std::collections::hashmap::{Keys, Occupied, SetItems, Vacant}; +use std::collections::hash_map::{Keys, Occupied, Vacant}; +use std::collections::hash_set::SetItems; pub struct Graph { nodes: HashMap> diff --git a/src/etc/dl-snapshot.py b/src/etc/dl-snapshot.py index 06426386e..a09ce2375 100644 --- a/src/etc/dl-snapshot.py +++ b/src/etc/dl-snapshot.py @@ -26,9 +26,11 @@ elif triple == 'i686-apple-darwin': me = mac32 elif triple == 'x86_64-apple-darwin': me = mac64 -elif triple == 'i686-w64-mingw32': +elif triple == 'i686-pc-windows-gnu': + triple = 'i686-w64-mingw32' me = win32 -elif triple == 'x86_64-w64-mingw32': +elif triple == 'x86_64-pc-windows-gnu': + triple = 'x86_64-w64-mingw32' me = win64 else: raise Exception("no snapshot for the triple: " + triple) -- 2.30.2